<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<style>
table{border-collapse:collapse;}
th {background-color:#ddd;}
th, td{border:1px solid #000; padding:5px;}
a{border-collapse:collapse;background-color:#ddd;color:#000; padding:3px;}
</style>

<h1>Robot list</h1>
<c:if test="${error == 0}">
<a href="<c:url value="/forms/robot/add"></c:url>">Pridej robot</a><br />
</c:if>

<table>
<tr>
	<th>Name</th>
	<th>Version</th>
	<th>Description</th>
	<th>action</th>
</tr>
<c:forEach items="${robots}" var="robot">
<tr>
	<td>
		<a href="<c:url value="/forms/robot/detail?id=${robot.getId()}"></c:url>">${robot.getName()}</a>
	</td>
	<td>${robot.getVersion()}</td>
	<td>${robot.getDescription()}</td>
	<td>
		<c:choose>
			<c:when test="${error == 0}">
				<a href="<c:url value="/forms/robot/edit?id=${robot.getId()}"></c:url>">edit</a></td>
			</c:when>
			<c:otherwise>
				-
			</c:otherwise>
		</c:choose>
	
</tr>
</c:forEach>
</table>